/**
 * never 类型与穷尽性检查
 * never 不应该存在的状态
 * */

// 第一个类型
interface Circle {
  kind: 'circle',
  radius: number,
}

// 第二个类型
interface Square {
  kind: 'square',
  sideLength: number
}

// 此处定义第三个类型 去 触发穷尽性检查
interface Triangle {
  kind: 'triangle',
  sideLength: number
}

type Shape_never = Circle | Square | Triangle


function getArea_never(shape: Shape_never) {
  switch (shape.kind) {
    case 'circle':
      return Math.PI * shape.radius ** 2;
    case 'square':
      return shape.sideLength ** 2;
    case 'triangle':
      return (shape.sideLength) / 2;
    default:
      const _exhaustiveCheck: never = shape;
      return _exhaustiveCheck
  }
}

// getArea_never({
//   kind: 'triangle',
//   sideLength: 100,
// })